<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>

</head>

<body>
    <img src="" id="showImg">
    <a id="a-upon">
        <input type="file" id="inputImage" accept="image/gif,image/jpeg">
    </a>
</body>

</html>
<script>
    $("#inputImage").change(function() {
        var obj = $(this)[0].files[0];
        var winUrl = window.URL;
        var dataURL = winUrl.createObjectURL(obj);
        $("#showImg").attr("src", dataURL);
    });

    // var deb = {
    //     hello: "what are you 弄啥类！"
    // };
    // var blob = new Blob([JSON.stringify(deb, null, 2)], {
    //     type: 'application/json'
    // });
    // console.log(blob);

    var builder = new Blob();
    var fileParts = ['<a id="a"><b id="b">hey!</b></a>'];
    builder.append(fileParts[0]);
    var myBlob = builder.getBlob('text/xml');
    console.log(myBlob);
</script>